#include "ReNameDialog.h"

QString un_utf8(const char*ChineseString);

ReNameDialog::ReNameDialog(const QString& Title,const QString &OldName,QWidget *parent,const char *name)
  :UTIL_Dialog(UTIL_Dialog::DTMiddleSize,true, parent,name,ZBaseDialog::APP_MODAL,0)
{
 	setHasTitle(true) ;
	 setDlgTitle(Title);

	 ZScrollView* sv = new ZScrollView(this);
  sv->enableClipper(true);
	
	 //QLabel* label = new QLabel(tr("Name: "),sv->viewport());
	//label->resize( 200,25);
	 //sv->addChild(label, 5,  0);

	LineEdit = new ZMultiLineEdit( sv->viewport(),true,3);
	LineEdit->resize(190,25);
	LineEdit->setWordWrap(ZMultiLineEdit::FixedPixelWidth);	
	LineEdit->setWrapColumnOrWidth(190);
	LineEdit->setWrapPolicy(ZMultiLineEdit::Anywhere);
	LineEdit->setText(OldName);
 	sv->addChild(LineEdit, 5, 25,true);
	setDlgContent(sv);

 	QHBox *hb = new QHBox(this);
  setDlgCst(hb);

	 ZPushButton *OkBtn = new ZPushButton( "",tr("OK"), hb, 0, 0, 0);
	 OkBtn->setGeometry(ZGlobal::mapFromGlobalR(OkBtn, ZGlobal::getDlgA2a_1R())); // DlgA Layout rules
  QObject::connect(OkBtn, SIGNAL(clicked()), this, SLOT(accept()));
	
	 ZPushButton *ClearBtn = new ZPushButton( "", tr("Cancel"), hb, 0, 0, 0);
	 ClearBtn->setGeometry(ZGlobal::mapFromGlobalR(ClearBtn, ZGlobal::getDlgA2a_2R()));
  QObject::connect(ClearBtn, SIGNAL(clicked()), this, SLOT(reject()));
}
ReNameDialog::~ReNameDialog()
{
}
QString ReNameDialog::getNewName()
{
  return LineEdit->text();
}

